e42:                   ; general copy:   93-06-20 02:04 HJ 
     jl  w3  d12       ;   check message buf;
     rl  w3  x1+a29    ;   first:=saved w1;
     sh  w3 (x1+a17)
     sn  w3 (x1+a17)   ; if paramaddr<first addr(cur) then
     jl. 4
     jl      c29       ;   goto internal 3

     al  w3  x3+6
     sl  w3 (x1+a18)   ; if paramaddr+6 > top addr(cur) then
     jl      c29       ;   goto internal 3
 
     rl  w0  x3-4      ; w0:=first
     rl  w3  x3-2      ; w3:=last
    
     sl  w3  (x1+a17)  ; check:
     sl  w0  (x1+a18)  ;   if first<first addr(cur)
     jl      c29       ;   or last>=top addr(cur)
     ws  w0  6         ;   or first>last then
     sh  w0  -1        ;     goto internal 3
     jl      c29       ; 

     ac  w3  (x2+4)    ;   rec:= -(-receiver(mess))
     so  w3  2.1       ;   if rec odd
     sh  w3  0         ;   or rec<=0 then
     jl      c29       ;     goto internal 3
     rl  w0  x3+a10    ; 
     sn  w0  64        ;   if rec is a pseudo process then
     rl  w3  x3+a50    ;     rec:=main(rec);
     se  w3  x1        ;   if rec<>cur then
     jl      c29       ;     goto internal3;

     bz  w3  x2+8      ;
     so  w3  2.1       ;   if operation(mes) even then
     jl      c29        ;     goto result3;

     jl.        g4.    ;    goto link call;






; general copy
;
; call: m157
; error return: result 2, if sender.buf is stopped
;               result 3, if message regretted
;               result 3, if addresses.buffer illegal

b. g10, h10 w.

m157:                  ; general copy    93-06-20 02:04 HJ :
     rl. w1     d2.    ;    w1 := sender;
     rl  w3  x1+a30    ;    w3 := buf := save w2.sender;
     rl  w2  x3+6      ;    w2 := sender.buf;
     sh  w2    -1      ;    if sender.buf < 0 then
     jl.        j3.    ;      result 3;  i.e. message regretted;

     bz  w0  x2+a13    ;    if state(sender.buf) = stopped then
     sz  w0     a105   ;
     jl.        j2.    ;      goto result 2;

     rl  w3 (x1+a29)   ;    w1:=core(saved w1); comment function word;
     la. w3  h1.       ;    mask relpos
     ls  w3  -1
     am     (x1+a30)
     dl  w0  x3+10     ;    w3 := first addr.buf;  w0 := last addr.buf;
     am     (x1+a30)
     wa  w3  6         ;    first:=first+start relative
     sl  w3 (x2+a17)   ;    if addresses outside sender-process then
     sl  w0 (x2+a18)   ;
     jl.        j3.    ;      goto result 3;
     la. w3     h0.    ;
     la. w0     h0.    ;    (make addresses even)
     sh  w0  x3-1      ;    if last address < first address then
     jl.        j3.    ;      goto result 3;

     ws  w0     6      ;    w0 := size of area(buf);    (less two bytes)
c.-8000 ; if rc8000 then
     wa  w3  x2+a182   ;    w3 := abs first of area(buf);
z.
     ds. w0     h3.    ;    save (first addr, size);

     am     (x1+a29)
     dl  w0  4         ;    w3:=first of area.sender; w0:=last of area.sender;
     la  w3  h0        ;    w3 := first of area.sender;  (even)
     la  w0  h0        ;    w0 := last  of area.sender;  (even)
     ws  w0     6      ;    w0 := size of area.sender;  (less two bytes)
c.-8000 ; if rc8000 then
     wa  w3  x1+a182   ;    w3 := abs first of area.sender;
z.

     al  w2  x3        ;    w2 := from := abs first of area.sender;
     rl  w3 (x1+a29)
     rl. w1     h2.    ;    w1 := to   := abs first of area(buf);

     so  w3     1      ;    if operation.buf = input then
     jl.        g5.    ;      goto prepare move;
h4:  rx  w2     2 ;used;    exchange (from, to);

g5:                    ; prepare move:

; w0 = size of area.sender (less two)
; w1 = to-address
; w2 = from-address

     sl. w0    (h3.)   ;    bytes to move :=
     rl. w0     h3.    ;      minimum (size.sender, size.buf)
     ba. w0     h4.+1  ;      + 2;
     rs. w0     h3.    ;    save (bytes to move);

     jl. w3     e31.   ;    move;

; now the data has been moved between sender-process and buffer-area
; compute the number of bytes and characters transferred and deliver to
;   sender-process

     rl. w2     h3.    ;    w2 := bytes moved;
     al  w3  x2        ;
     ls  w3    -1      ;
     wa  w3     4      ;    w3 := chars moved;  ( = bytes * 3 / 2 )

     rl. w1    (d20.)  ;
     rs  w2  x1+a29    ;    save w1.sender := bytes moved;
     rs  w3  x1+a31    ;    save w3.sender := chars moved;

     jl.        j0.    ;    goto result 0;

h0:  -1 < 1            ; mask for making even
h1:  2.1110            ; mask for relpos in function word
h2:  0                 ; abs first of area(buf)
h3:  0                 ; size of area(buf)
                       ; (later:  bytes to move)

e.                     ;

